<?php
$isEdit=isset($edit);
if (isset($from)) 
    $from='/'.$from;
else
    $from='';
                      
$FormOption=array('class'=>'form-horizontal');
if ($isEdit)
    $FormOption['url'] = '../stories/edit/'.$story['Story']['id'].$from;

echo $this->Form->create('Story',$FormOption); 

$optionsLabel1 = array('class' => 'control-label','text'=>'Resumen');
$options1 = array('value'=>$story['Story']['summary'],'div' => 'control-group','label'=>$optionsLabel1,'class'=>'controls');
if (!$isEdit)
    $options1['disabled']="disabled";
echo $this->Form->input('summary',$options1);

$optionsLabel2 = array('class' => 'control-label','text'=>'Detalle');
$options2 = array('value'=>$story['Story']['detail'],'div' => 'control-group','label'=>$optionsLabel2,'class'=>'controls','rows' => '3');
if (!$isEdit)
    $options2['disabled']="disabled";
echo $this->Form->input('detail',$options2);


$optionsLabelS = array('class' => 'control-label','style'=>'padding-right:20px','text'=>'Sprint');

//var_dump($story);
$pSprints=$project['Project']['sprints'];
$arrOptions=array();
            for ($i=0;$i<$pSprints;$i++){
                $idS=$i;
                $nameS='Sprint '.($idS+1);
                $arrOptions[$idS]=$nameS;

    }
if (!$isEdit)
    echo $this->Form->input('sprint', array(
    'options' => $arrOptions,'disabled'=>"disabled",'value' => $story['Story']['sprint'],'div' => 'control-group','class'=>'chzn-select',
    'label'=>$optionsLabelS ));
else
    echo $this->Form->input('sprint', array(
    'options' => $arrOptions,'value' => $story['Story']['sprint'],'div' => 'control-group','class'=>'chzn-select',
    'label'=>$optionsLabelS ));



/*ESTIMACION*/
$options = array('-1' => '?', '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '5', '5' => '8', '6' => 'Infinito');
echo $this->Form->input('id', array('type' => 'hidden','value'=>$story['Story']['id']));
    $attributes = array('value'=>$story['Story']['points'],'legend'=>false,'separator' => '</td><td>'); 
    if (!$isEdit)
        $attributes['disabled']="disabled";
    ?>
    <div class="control-group">
    <label class="control-label">Estimación</label>
    <table style="margin-left: 20px; display: inline-block;  margin-bottom: 0; width: 200px;">
        <tr>
            <td>
            <?php
//                                        if($story['points']==0)
                    echo $this->Form->radio('points', $options, $attributes);
//                                        else
//                                            echo $story['points'];
            ?>
            </td>
        </tr>
    </table>
    </div>

    <?php
    //RESPONSABLE
    $arrOptionsMember=array();
    for ($i=0;$i<count($members);$i++){
        $idM=$members[$i]['id'];
        $nameM=$members[$i]['username'];
        $arrOptionsMember[$idM]=$nameM;
    }
    ?>


    <?php
    $optionsLabelRes = array('class' => 'control-label','style'=>'padding-right:20px','text'=>'Responsable');
    $optionsEst=array(
                'options' => $arrOptionsMember,'class'=>'chzn-select','div' => 'control-group',
                'value'=>$story['Story']['responsible_id'],
                'label' => $optionsLabelRes,
                'empty' => '(choose one)'
            );
    if (!$isEdit)
        $optionsEst[ 'disabled']="disabled";
    echo $this->Form->input('responsible_id',$optionsEst );?>



<?php
/*ESTADO!!*/
$options = array('0' => '<span class="badge badge-inverse">ToDo</span>',
                '1' => '<span class="badge badge-warning">Doing</span>',
                '2' => '<span class="badge badge-info">Review</span>',
                '3' => '<span class="badge badge-success">Done</span>');
    $attributes = array('value'=>$story['Story']['state'],'legend'=>false,'scape'=>false,'separator' => '</div></td>    <td><div class="inline_labels">'); 
    if (!$isEdit)
        $attributes[ 'disabled']="disabled";?>
    <div class="control-group">
    <label class="control-label">Estado</label>
    <style>
        .inline_labels label{  display: inline-block;}

    </style>

    <table style="margin-left: 20px; display: inline-block;  margin-bottom: 0; width: 360px; padding-top: 5px">
        <tr>
            <td>
                <div class="inline_labels">
            <?php   echo $this->Form->radio('state', $options, $attributes);
            ?>
                </div>
            </td>
        </tr>
    </table>
    </div>

<?php   
if(!$isEdit)
echo $this->Form->end();
?>